﻿#include <iostream>
#include <vector>
#include <string>

#define main test_main

static unsigned int count=1;

typedef int UINT4;
using namespace std;
class Hack
{
	public:
	std::string name_;
	std::string namett_;
	//Hack(const std::string & name="") : name_(name) { std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl; std::cout<<"i am "<<name_<<" .ctor"<<std::endl;};///@alex:注意，这边的count因为是全局域上的，所以要加上::才可以
	Hack(const std::string & name="", const std::string & name_tt="hello") : name_(name), namett_(name_tt) { std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl; std::cout<<"i am "<<name_<<" .ctor"<<std::endl;};
	Hack(const Hack & copy) { std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl; name_=copy.name_; std::cout<<"i am "<<name_<<" .copy ctor"<<std::endl;};
};

Hack& operator< (Hack &a , Hack &b)
{ std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;
    std::cerr << "operator< "<<a.name_<<" "<<b.name_<<"\n";
    std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;return a;
}

Hack& operator> (Hack &a, Hack &b)
{std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;
    std::cerr <<  "operator> "<<a.name_<<" "<<b.name_<<"\n";
  std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;  return a;
}

int main(int argc, char ** argv)
{std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<".file is: "<<__FILE__<<std::endl;///@alex:这边的__LINE__和__FILE__都是gnu的宏，帮助进行log和debug，全部是在预处理的时候执行的，可以结合count进行覆盖率分析
    Hack vector("vector");std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;
    Hack UINT4("UINT4");std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;
    Hack foo("foo");std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;
	Hack tt;std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;
std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;
    vector<UINT4> foo;std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;
std::cout<<"cout: "<<::count++<<".line is: "<<__LINE__<<std::endl;
return(0);
}

